package com.api.smoke.push;

import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.api.test.VoidContextLoader;
import com.api.util.repo.impl.DomainUser;
import com.zyncro.api.IPushApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.PhoneTypeApi;

@ContextConfiguration(loader = VoidContextLoader.class)
public class PushSmoke extends AbstractApiTest {

	@BeforeClass
	protected void setUp() throws Exception {

		String domainName = this.getClass().getSimpleName();
		DomainUser mainAdmin = getRepo().getMainUser(domainName);

		getApi().login(mainAdmin.getAppId(), mainAdmin.getPassword());
	}

	@Test
	public void testRegisterUnregister() throws ZyncroApiException {

		PhoneTypeApi phoneType = PhoneTypeApi.IPAD;
		String deviceId = "testDeviceId";

		getApi().getService(IPushApiService.class).registerToPushService(phoneType, deviceId);

		getApi().getService(IPushApiService.class).unregisterToPushService(deviceId);
	}
}
